#include "MGUI_CheckBox.h"
#include "MGUI_Engine.h"

namespace Myway {

	ImplementRTTI(MGUI_CheckBox, MGUI_Widget);

	MGUI_CheckBox::MGUI_CheckBox(const MGUI_LookFeel * _lookfeel, MGUI_Widget * _parent)
		: MGUI_Widget(_lookfeel, _parent)
	{
		mChecked = false;
	}

	MGUI_CheckBox::~MGUI_CheckBox()
	{
	}

	void MGUI_CheckBox::OnUpdateWidgetState()
	{
		if (mChecked && mEnable)
		{
			mState = MGUI_WidgetState::Selected;
		}
	}
	
	void MGUI_CheckBox::OnMousePressed(int _x, int _y, MGUI_MouseButton _id)
	{
	}

	void MGUI_CheckBox::OnMouseReleased(int _x, int _y, MGUI_MouseButton _id)
	{
		if (_id == MGUI_MouseButton::Left)
		{
			mChecked = !mChecked;

			eventChecked(mChecked);
		}
	}



}